perm filename RADDR.FAI[S,NET] blob
sn#794283 filedate 1985-05-27 generic text, type T, neo UTF8
title raddr
;Query resolver to translate Internet address to host name.
a←1
b←2
c←3
d←4
p←17
pdlen←20
pdl: block pdlen
sndblk: '[RSLV]'
mess
mess: 'DOM',,0
0,,7
123,,456
domain: block =32
imess: block =32
start: move p,[iowd pdlen,pdl]
pjob 1,
hrrm 1,mess
outstr [asciz/
Address: /]
move b,[point 8,domain,3]
setz c,
inch: inchwl a
cain a,12
jrst copy
cain a,15
jrst inch
caie a,"."
jrst inch1
idpb c,b
setz c,
jrst inch
inch1: imuli c,=10
addi c,-"0"(a)
jrst inch
copy: idpb c,b
retry: send sndblk
jrst snderr
wrcv imess
hrrz a,imess+1 ;Reply code
jrst @rdisp(a) ;Dispatch
rdisp: bad
error
timeout
nomatch
bad
bad
bad
answer
bad
bad
bad
bad: outstr [asciz/Unexpected reply code received from resolver.
/]
jrst start
error: outstr [asciz/Error: /]
outstr imess+3
outstr [asciz/
/]
jrst start
timeout:outstr [asciz/No response from name servers.
/]
jrst start
nomatch:outstr [asciz/Not a valid host name.
/]
jrst start
answer: outstr [asciz/Name: /]
outstr imess+3
outstr [asciz/
/]
jrst start
snderr: outstr [asciz/Resolver's mailbox full. Retrying.
/]
movei a,1
sleep a,
jrst retry
decout: idivi a,=10
hrlm b,(p)
jumpe a,.+2
pushj p,decout
hlrz b,(p)
addi b,"0"
outchr b
popj p,
end start